//
// Maths.cpp for  in /home/goldbe_y//cpp/Maths/208prop
//
// Made by yoni goldberg
// Login   <goldbe_y@epitech.net>
//
// Started on  Wed May 18 17:21:57 2011 yoni goldberg
// Last update Sat May 28 19:08:12 2011 yoni goldberg
//

#include "Maths.hpp"

Maths::Maths(std::string _str, std::vector<float> tab, int _n)
{
  str = _str;
  n = _n;
  val = tab;
  prop();
}

void		Maths::aff()
{
  std::cout << "Population : " << str << std::endl;
  std::cout << "Nombre d'individus : " << val.size() << std::endl;
  std::cout << "Proportion p : " << count / val.size() << std::endl;
  std::cout << "Ecart-Type s : " << sqrt(p * (1 -p)) << std::endl;
  std::cout << "Echantillons de taille : " << n << std::endl;
  std::cout << "Nombre d'echantillons : " << cnn(n, (int)val.size()) << std::endl;
  std::cout << "Moyenne : " << moy() << std::endl;
}

void		Maths::prop()
{
  count = 0;
  for (unsigned int i = 0; i < val.size(); i++) {if (val[i] >= 960)count++;}
}

int		Maths::cnn(int nb1, int nb2)
{
  int	res = 1, div = 1;
  for (int i = (nb1 < (nb2 - nb1)) ? nb1 : (nb2 - nb1); i > 0; i--) {res *= (nb2--); div *= (i);}
  comb = (res/div);
  return (comb);
}

int		Maths::moy()
{
}
